package com.sanyang.lawyer.controller.finance;

import com.sanyang.lawyer.entity.*;
import com.sanyang.lawyer.mapper.Case.Case_lawMapper;
import com.sanyang.lawyer.mapper.finance.Finance_empincomeMapper;
import com.sanyang.lawyer.mapper.system.System_userMapper;
import com.sanyang.lawyer.service.Case.Case_lawService;
import com.sanyang.lawyer.service.finance.Finance_empincomeService;
import com.sanyang.lawyer.service.finance.Finance_incomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: lawyer
 * @description: 我的收入
 * @author: lql
 * @create: 2019-10-25 14:44
 **/
@RestController
@RequestMapping("financeIncomeController")
public class FinanceIncomeController {

        @Autowired
        private System_userMapper system_userMapper;
        @Autowired
        private Finance_empincomeService finance_empincomeService;
        @Autowired
        private Finance_incomeService finance_incomeService;
        @Autowired
        private Case_lawMapper case_lawMapper;

        @RequestMapping("user")
        @ResponseBody
        public System_user user(String username){
            System_user user=system_userMapper.getByName(username);
            return user;
        }

        //个人工资详细
        @RequestMapping("empincome")
        @ResponseBody
        public List<Finance_empincome> list(int empid){
            List<Finance_empincome> list=finance_empincomeService.list(empid);
            System.out.println(list);
            return list;
        }

        //根据时间查询
        @RequestMapping("incomelist")
        @ResponseBody
        public List<Finance_income> lists(String enddate,String startdate){
            Map<String,String> map=map(enddate,startdate);
            List<Finance_income> list=finance_incomeService.lists(map);
            return list;
        }

        public Map<String,String> map(String enddate,String startdate){
            Map<String,String> map=new HashMap<String,String>();
            map.put("enddate",enddate);
            map.put("startdate",startdate);
            return map;
        }

        //根据案号查询案件信息
        @RequestMapping("caselist")
        @ResponseBody
        public Case_law caselaw(String caseid){
            Case_law list=case_lawMapper.queryOne(caseid);
            return list;
        }

}
